Next | Prev | Up | Top | Contents | Index

Controlling Miscellaneous Optimizations

The following -OPT options allow control over a variety of optimizations.

-OPT:space

The MIPSpro compilers normally make optimization decisions based strictly on the expected execution time effects. If code size is more important, use this option. One of its effects is to cause most subprogram exits to go though a single exit path, with a single copy of register restores, result loads, and so forth.

-OPT:alias=name


The compilers must normally be very conservative in optimization of memory references involving pointers (especially in C), since aliases (that is, different ways of accessing the same memory) may be very hard to detect. This option may be used to specify that the program being compiled avoids aliasing in various ways. alias options are listed below.

-OPT:alias=any

The compiler assumes that any pair of memory references may be aliased unless it can prove otherwise. This is the default.

-OPT:alias=typed


The compiler assumes that any pair of memory references that reference distinct types in fact reference distinct data. For example, consider the code:

void dbl ( int *i, float *f ) {

*i = *i + *i;

*f = *f + *f;

}

The compiler assumes that i and f point to different memory, and produces an overlapped schedule for the two calculations.

-OPT:alias=unnamed


The compiler assumes that pointers never point to named objects. For example, consider the code:

float g;

void dbl ( float *f ) {

g = g + g;

*f = *f + *f;

}

The compiler assumes that f cannot point to g, and produces an overlapped schedule for the two calculations.

This option also implies the alias=typed assumption. Note that this is the default assumption for the pointers implicit in Fortran dummy arguments according to the ANSI standard.

-OPT:alias=restrict


The compiler assumes a very restrictive model of aliasing, where no two pointers ever point to the same memory area. For example, consider the code:

void dbl ( int *i, int *j ) {

*i = *i + *i;

*j = *j + *j;

}

The compiler assumes that i and j point to different memory, and produces an overlapped schedule for the two calculations.

Although this is a very dangerous option to use in general, it may produce significantly better code when used for specific well-controlled cases where it is known to be valid.


Controlling Loop Unrolling

The following options control loop unrolling in the MIPSpro optimizer (that is, making multiple copies of a loop body to minimize the loop overhead or to expose more instruction parallelism). Unrolling is subject to a number of limits in the optimizer, intended to balance the run-time benefits against code expansion. These options allow you to modify those limits when they can be improved. Note that loops expected to be software pipelined are subject to similar options in the -SWP group.

-OPT:unroll_times_max=n


The optimizer normally unrolls loops at most 2 times (-mips4) or 4 times (-mips3), unless it can unroll them completely. This option modifies the default limit.

-OPT:unroll_size=n


The optimizer normally unrolls loops only to the extent that the resulting unrolled loop body contains at most 320 instructions. This option modifies the default limit.

-OPT:unroll_bblimit=n


The optimizer normally unrolls loops containing up to 10 basic blocks. This option modifies the default limit. (A basic block is a sequence of code between branches and labels; it has single entry at the top and a single exit at the bottom.)

Next | Prev | Up | Top | Contents | Index